External Player support fix (MX Player and others) | 您所在的位置:网站首页 › kodi waiting › External Player support fix (MX Player and others) |
diff --git a/xbmc/android/activity/XBMCApp.cpp b/xbmc/android/activity/XBMCApp.cpp
index 9f8e8c1..cbc21f1 100644
--- a/xbmc/android/activity/XBMCApp.cpp
+++ b/xbmc/android/activity/XBMCApp.cpp
@@ -408,7 +408,29 @@ bool CXBMCApp::StartActivity(const string &package, const string &intent, const
if (!intent.empty())
newIntent.setAction(intent); - startActivity(newIntent); + startActivity(newIntent); + return true; +} + +// Note intent, dataType, dataURI all default to "" +bool CXBMCApp::StartExternalPlayerActivity(const string &package, const string &intent, const string &dataType, const string &dataURI) +{ + if (intent.empty()) + return false; + + CJNIIntent newIntent(intent); + if (!newIntent) + return false; + + if (!dataURI.empty()) + { + CJNIURI jniURI = CJNIURI::parse(dataURI); + newIntent.setDataAndType(jniURI, dataType); + } + + newIntent.setPackage(package); + + startActivity(newIntent); return true; } diff --git a/xbmc/android/activity/XBMCApp.h b/xbmc/android/activity/XBMCApp.h index 7f23a67..d21cdca 100644 --- a/xbmc/android/activity/XBMCApp.h +++ b/xbmc/android/activity/XBMCApp.h @@ -85,6 +85,7 @@ public: static int GetBatteryLevel(); static bool StartActivity(const std::string &package, const std::string &intent = std::string(), const std::string &dataType = std::string(), const std::string &dataURI = std::string()); + static bool StartExternalPlayerActivity(const std::string &package, const std::string &intent = std::string(), const std::string &dataType = std::string(), const std::string &dataURI = std::string()); static bool ListApplications(std::vector *applications); static bool GetIconSize(const std::string &packageName, int *width, int *height); static bool GetIcon(const std::string &packageName, void* buffer, unsigned int bufSize); diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp index a094536..8b3f6be 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp @@ -484,7 +484,7 @@ BOOL CExternalPlayer::ExecuteAppAndroid(const char* strSwitches,const char* strP { CLog::Log(LOGNOTICE, "%s: %s", __FUNCTION__, strSwitches); - int ret = CXBMCApp::StartActivity(strSwitches, "android.intent.action.VIEW", "video/*", strPath); + int ret = CXBMCApp::StartExternalPlayerActivity(strSwitches, "android.intent.action.VIEW", "video/*", strPath); if (ret != 0) { |
CopyRight 2018-2019 实验室设备网 版权所有 |